import plugin from '../../lib/plugins/plugin.js'
import { segment } from "oicq";
const _path = process.cwd();

//插件作者：煌（2608259582） 于2022/01/14编写，请勿大范围传播，首发摆烂群（891838593）.
//纠正名称部分原作者：西北一枝花（1679659）.
//史上最长正则与最多let，没有之一！（bushi）.

//使用前请先删除Yunzai-Bot/config/config/group.yaml文件里的第七行及下方Bot名称.

let botname = '纳西妲' // 此处修改为自己的Bot名字.

//图库链接
let img_1 = `https://i.imgtg.com/2023/01/14/Q1EBP.gif`
let img_2 = `https://i.imgtg.com/2023/01/13/QhT6Y.jpg`
let img_3 = `https://i.imgtg.com/2023/01/14/Q1GZb.gif`
let img_4 = `https://i.imgtg.com/2023/01/14/Q1Q0l.jpg`
let img_5 = `https://i.imgtg.com/2023/01/14/Q10Mg.gif`
let img_6 = `https://i.imgtg.com/2023/01/14/Q1dHs.gif`
let img_7 = `https://i.imgtg.com/2023/01/14/Q1sXK.gif`
//1-7为名称回复，8-17为纠正名称.
let img_8 = `https://i.imgtg.com/2023/01/14/QrJd6.jpg`
let img_9 = `https://i.imgtg.com/2023/01/14/QrRaP.gif`
let img_10 = `https://i.imgtg.com/2023/01/14/Qrteb.png`
let img_11 = `https://i.imgtg.com/2023/01/14/Qr4El.jpg`
let img_12 = `https://i.imgtg.com/2023/01/14/QrDIg.jpg`
let img_13 = `https://i.imgtg.com/2023/01/14/QrLhB.png`
let img_14 = `https://i.imgtg.com/2023/01/14/QrERs.png`
let img_15 = `https://i.imgtg.com/2023/01/14/QrGjK.jpg`
let img_16 = `https://i.imgtg.com/2023/01/14/QrSWa.jpg`
let img_17 = `https://i.imgtg.com/2023/01/14/Qr0yS.gif`

/*
//本地图片（删除上方图库链接后取消注释使用）.
//${_path}表示云崽目录，自行选择图片存放路径.
let img_1 = `file:///${_path}/resources/img/img_1.png`
let img_2 = `file:///${_path}/resources/img/img_2.png`
let img_3 = `file:///${_path}/resources/img/img_3.png`
let img_4 = `file:///${_path}/resources/img/img_4.png`
let img_5 = `file:///${_path}/resources/img/img_5.png`
let img_6 = `file:///${_path}/resources/img/img_6.png`
let img_7 = `file:///${_path}/resources/img/img_7.png`
//1-7为名称回复，8-17为纠正名称.
let img_8 = `file:///${_path}/resources/img/img_8.png`
let img_9 = `file:///${_path}/resources/img/img_9.png`
let img_10 = `file:///${_path}/resources/img/img_10.png`
let img_11 = `file:///${_path}/resources/img/img_11.png`
let img_12 = `file:///${_path}/resources/img/img_12.png`
let img_13 = `file:///${_path}/resources/img/img_13.png`
let img_14 = `file:///${_path}/resources/img/img_14.png`
let img_15 = `file:///${_path}/resources/img/img_15.png`
let img_16 = `file:///${_path}/resources/img/img_16.png`
let img_17 = `file:///${_path}/resources/img/img_17.png`
*/

export class example extends plugin {
  constructor() {
    super({
      name: '名称回复',
      dsc: '回复图文及纠正名称',
      event: 'message',
      priority: 500,
      rule: [
        {//无需修改此处reg.
          reg: `^#?(在)?(吗|干吗|干嘛|哪|那|哪里|那里|么)?(丫|鸭|呀|呐|呢|喵)?[~～.。,，!！、？]?${botname}(在)?(吗|干吗|干嘛|哪|那|哪里|那里|么)?(丫|鸭|呀|呐|呢|喵)?[~～.。,，!！、？]?$`,
          fnc: 'huifu'
        },
        {//下方reg里(依|衣|11|一一|伊)修改成自己Bot名字最后一字的谐音，多个用'|'隔开.
          reg: '^#*[\u4e00-\u9fa5]+(纳西妲)$',
          fnc: 'jiuzheng'
        }
      ]
    })
  }

  async huifu(e) {
    let number = Math.round(Math.random() * 100 + 1)
    let msg = ''
    if (number < 15) {
      msg = [`来了来了，${botname}一直在呢~\n`,
      segment.image(`${img_1}`)]
    } else if (number < 30) {
      msg = [`你喊${botname}做什么，${botname}也是很忙的好吧！\n`,
      segment.image(`${img_2}`)]
    } else if (number < 45) {
      msg = [`${botname}在哦，有什么吩咐吗?\n`,
      segment.image(`${img_3}`)]
    } else if (number < 60) {
      msg = [segment.image(`${img_4}`)]
    } else if (number < 75) {
      msg = [`你干嘛~哈哈哎呦~\n`,
        segment.image(`${img_5}`)]
    } else if (number < 90) {
      msg = [`你好烦丫，${botname}不就在这吗?\n`,
      segment.image(`${img_6}`)]
    } else {
      await this.reply('我——！')
      setTimeout(async () => {
        await this.reply('在——！')
      }, 300)
      setTimeout(async () => {
        await this.reply('呢——！')
      }, 600)
      setTimeout(async () => {
        await this.reply([segment.image(`${img_7}`)])
      }, 900)
      return true
    }
    /* 最后引用msg回复消息 */
    await this.reply(msg)
    return true
  }

  async jiuzheng(e) {
    let char = e.toString()
    let charArr = char.split('').join('——')
    let botArr = botname.split('').join('——')
    let number = Math.round(Math.random() * 100 + 1)
    let msg = ''
    if (number < 10) {
      msg = [`是${botname}啦！气气，哼>_<`,
      segment.image(`${img_8}`)]
    } else if (number < 20) {
      msg = [`${charArr}——是——谁——啦~`,
      segment.image(`${img_9}`)]
    } else if (number < 30) {
      msg = [`是${botname}好叭！！！`,
      segment.image(`${img_10}`)]
    } else if (number < 40) {
      msg = [`哎呀~才不是什么${char}！！！`,
      segment.image(`${img_11}`)]
    } else if (number < 50) {
      msg = [`${char}是什么？可以吃吗？`,
      segment.image(`${img_12}`)]
    } else if (number < 60) {
      msg = [`不许叫我${char}啦！！！`,
      segment.image(`${img_13}`)]
    } else if (number < 70) {
      msg = [`笨比，人家明明叫${botname}！！！`,
      segment.image(`${img_14}`)]
    } else if (number < 80) {
      msg = [`小黑子什么意思，连“${botname}”俩字都能打错?`,
      segment.image(`${img_15}`)]
    } else if (number < 90) {
      msg = [`人家叫${botname}，才不是什么${char}！！！`,
      segment.image(`${img_16}`)]
    } else {
      await this.reply('我——是——！！')
      setTimeout(async () => {
        await this.reply(`${botArr}——！！`)
      }, 300)
      setTimeout(async () => {
        await this.reply('气——气——！！')
      }, 600)
      setTimeout(async () => {
        await this.reply([segment.image(`${img_17}`)])
      }, 900)
      return true
    }
    /* 最后引用msg回复消息 */
    await this.reply(msg)
    return true
  }
  
}